package com.google.code.jholidays.events.parameters;

import com.google.code.jholidays.events.DependentEvent;

/**
 * Represents offset (in days) entity. This entity is used by
 * {@link DependentEvent} during it's date calculation.
 * <p>
 * Offset value can be retrieved using {@link #getDaysCount()} method. Offset
 * can be positive or negative. This can be checked using {@link #isPositive()}
 * method
 * 
 * @author tillias
 * 
 */
public class Offset {

    /**
     * Creates new instance of offset using given days count
     * 
     * @param daysCount
     *            Days count. Can be any number
     */
    public Offset(int daysCount) {
	this.daysCount = daysCount;
    }

    /**
     * Gets days count
     * 
     * @return Days count. Can be any number
     */
    public int getDaysCount() {
	return daysCount;
    }

    /**
     * Gets value indicating whether offset is positive or negative
     * 
     * @return Value indicating whether offset is positive or negative
     */
    public boolean isPositive() {
	return daysCount > 0;
    }

    @Override
    public String toString() {
	return Integer.toString(daysCount);
    }

    int daysCount;

}
